//
//  WYRightBarButtonItem.m
//  Boss
//
//  Created by admin on 2018/6/7.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYRightBarButtonItem.h"
#import "WYShadowButton.h"
@implementation WYRightBarButtonItem

-(instancetype)init
{
    if (self = [super init]) {
        [self createSubViews];
    }
    
    return self;
}
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self createSubViews];
    }
    
    
    
    return self;
}



-(void)createSubViews
{
    
    self.mesBtn = [[WYShadowButton alloc]init];
    [self addSubview:self.mesBtn];
    [self.mesBtn mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.right.mas_equalTo(0);
        make.width.mas_equalTo(44*DUP);
        make.height.mas_equalTo(44*DUP);
        make.top.bottom.mas_equalTo(0);
        
    }];
    
    
    
    self.shareBtn = [[WYShadowButton alloc]init];
    [self addSubview:self.shareBtn];
    [self.shareBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mesBtn.mas_left).offset(0);
        make.width.mas_equalTo(44*DUP);
        make.height.mas_equalTo(44*DUP);
        make.top.bottom.mas_equalTo(0);
    }];
//    self.shareBtn.layer.shadowOffset = CGSizeMake(0, 0);
//    UIColor *clr = [UIColor hexStringToColor:@"#A7AFC6" alpha:0.5];
//    self.shareBtn.backgroundColor = clr;
//    self.shareBtn.layer.shadowColor = clr.CGColor;
//    self.shareBtn.layer.shadowOpacity = 1.0;
//    self.shareBtn.layer.shadowRadius = 8;
//    self.shareBtn.layer.shadowPath = [UIBezierPath bezierPathWithRect:CGRectMake(8, self.bounds.size.height/2, self.bounds.size.width-(2*8), self.bounds.size.height/2)].CGPath;
    
    
    
    
    self.strategyBtn = [[WYShadowButton alloc]init];
    [self addSubview:self.strategyBtn];
    [self.strategyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.shareBtn.mas_left).offset(0);
        make.width.mas_equalTo(44*DUP);
        make.height.mas_equalTo(44*DUP);
        make.top.bottom.mas_equalTo(0);
        
    }];
    
    self.redBtn = [[WYShadowButton alloc]init];
    [self addSubview:self.redBtn];
    [self.redBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.strategyBtn.mas_left).offset(0);
        make.width.mas_equalTo(44*DUP);
        make.height.mas_equalTo(44*DUP);
        make.top.bottom.mas_equalTo(0);
    }];
//    
//     [self.shareBtn setBackgroundColor:[UIColor redColor]];
//     [self.strategyBtn setBackgroundColor:[UIColor redColor]];
//     [self.redBtn setBackgroundColor:[UIColor redColor]];
    
    [self.shareBtn setImage:[UIImage imageNamed:@"shadow_share"] forState:UIControlStateNormal];
    [self.strategyBtn setImage:[UIImage imageNamed:@"Strategy"] forState:UIControlStateNormal];
    [self.redBtn setImage:[UIImage imageNamed:@"newRedPacket"] forState:UIControlStateNormal];
    [self.mesBtn setImage:[UIImage imageNamed:@"message_icon"] forState:UIControlStateNormal];
//    [self.strategyBtn addTarget:self action:@selector(clickStrategy:) forControlEvents:UIControlEventTouchUpInside];
    
    
}
-(void)clickStrategy:(UIButton *)btn
{
    NSLog(@"1123131123123");
}

- (UIView*)hitTest:(CGPoint)point withEvent:(UIEvent *)event{
    UIView *hitView = [super hitTest:point withEvent:event];
    if(hitView == self){
        return nil;
    }
    return hitView;
}


@end
